package com.caigou.modules.jingpin.adpter

import android.text.TextUtils
import com.caigou.comm.base.utils.ImageLoader
import com.caigou.modules.jingpin.R
import com.caigou.modules.jingpin.bean.JingpinItemBean
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * @author #Suyghur.
 * Created on 2021/11/20
 */
class JingpinItemAdapter(dataset: MutableList<JingpinItemBean>) :
    BaseQuickAdapter<JingpinItemBean, BaseViewHolder>(R.layout.item_jingpin_list, dataset), LoadMoreModule {

    override fun convert(holder: BaseViewHolder, item: JingpinItemBean) {
        holder.setText(R.id.item_jingpin_tv_title, item.title)

        if (TextUtils.isEmpty(item.icon)) {
            holder.setImageResource(R.id.item_jingpin_iv_icon, R.drawable.img_comm_jingpin)
        } else {
            ImageLoader.loadCircle(context, item.icon, holder.getView(R.id.item_jingpin_iv_icon))
        }
    }
}